/**
 * 加载提示视图
 * chentao  2017/12/12
 * @flow
 */
import React, { PureComponent } from 'react';
import {
    View,
    Text,
    StyleSheet,
    Modal,
    ActivityIndicator,
} from 'react-native';
import {Screen} from '../common';

class BusyShow extends PureComponent{
    constructor(){
        super();
        this.state={
            modalVisible:false,
        }
    }
    hide(){
        this.setState({ modalVisible:false });
    }
    show(){
        this.setState({ modalVisible:true });
    }
    render(){
        return(
            <Modal
                animationType={'none'}
                transparent={true}
                visible={this.state.modalVisible}
                onRequestClose={() => { } }
            >
                <View style={styles.container}>
                    <ActivityIndicator
                        color={'#4db4ee'}
                        size="large"
                        {...this.props}
                        style={[styles.indicator,this.props.style]}

                    />
                </View>
            </Modal>
        );
    }
}

const styles = StyleSheet.create({
    indicator:{
        position:'absolute',
        top:Screen.height * 0.4,
        transform: [{scale: 1.0}]
    },
    container: {
        // flex: 1,
        width:Screen.width,
        height:Screen.height,
        justifyContent: 'center',
        alignItems:'center',
        backgroundColor:'rgba(0, 0, 0, 0.5)',
    },
});

export default BusyShow;
